/******************************************************************************
* Copyright (C) 2017 ShenZhen Powerdata Information Technology Co.,Ltd
* All Rights Reserved.
* 本软件为深圳博安达开发研制。未经本公司正式书面同意，其他任何个人、团体不得使用、
* 复制、修改或发布本软件.
*****************************************************************************/

package com.szboanda.execution;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


/**
* @Title:
* @author  zhangsheng
* @since   JDK1.6
* @history 2020年2月25日 TODO 新建
*/

public class ConnectionUtil {
    



    
    public Connection getMysqlConnection() {
        String url = "jdbc:mysql://127.0.0.1:3306/anhui?useUnicode=true&characterEncoding=UTF8&autoReconnect=true";
        String userName = "root";
        String password = "123";
        try {
            //Class.forName("oracle.jdbc.driver.OracleDriver");
            Class.forName("com.mysql.jdbc.Driver");
            return DriverManager.getConnection(url, userName, password);
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }
    public Connection getMysqlPlatformConnection() {
        String url = "jdbc:mysql://192.168.3.116:3306/platform?useUnicode=true&characterEncoding=UTF8&autoReconnect=true";
        String userName = "root";
        String password = "root123";
        try {
            //Class.forName("oracle.jdbc.driver.OracleDriver");
            Class.forName("com.mysql.jdbc.Driver");
            return DriverManager.getConnection(url, userName, password);
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }

    public Connection getOraclePlatformConnection() {
        String url = "jdbc:oracle:thin:@192.168.3.116:1521:ORCL";
        String userName = "U_PACP";
        String password = "U_PACP";
        try {
            //Class.forName("oracle.jdbc.driver.OracleDriver");
            Class.forName("oracle.jdbc.driver.OracleDriver");
            return DriverManager.getConnection(url, userName, password);
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }

    public Connection getOracleHjzlConnection() {
        String url = "jdbc:oracle:thin:@192.168.3.207:1521:ORCL";
        String userName = "U_HJZL_0225";
        String password = "U_HJZL_0225";
        try {
            //Class.forName("oracle.jdbc.driver.OracleDriver");
            Class.forName("oracle.jdbc.driver.OracleDriver");
            return DriverManager.getConnection(url, userName, password);
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }

    public Connection getSqlServerConnection() {
        String url = "jdbc:sqlserver://192.168.3.116:1433;integratedSecurity=true;databaseName=PAAS_EBS";
        String userName = "sa";
        String password = "szboanda";
        try {
            //Class.forName("oracle.jdbc.driver.OracleDriver");
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            return DriverManager.getConnection(url, userName, password);
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }

}
